package com.thinkcube.edutainment.adapters;

import java.util.List;

import org.androidannotations.annotations.EBean;
import org.androidannotations.annotations.RootContext;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.thinkcube.edutainment.domain.data.LessonContentData;
import com.thinkcube.edutainment.service.viewitem.LessonContntItem;
import com.thinkcube.edutainment.service.viewitem.LessonContntItem_;




@EBean
public class LessonContentAdapter extends BaseAdapter {

	List<LessonContentData> lessonContentDataList;

	@RootContext
	Context context;

	@Override
	public View getView(final int position, final View convertView,
			final ViewGroup parent) {

		LessonContntItem lessonContntItem;
		if (convertView == null) {
			lessonContntItem = LessonContntItem_.build(context);
		} else {
			lessonContntItem = (LessonContntItem) convertView;
		}

		lessonContntItem.bind(getItem(position));

		return lessonContntItem;
	}

	

	public List<LessonContentData> getLessonContentDataList() {
		return lessonContentDataList;
	}



	public void setLessonContentDataList(
			List<LessonContentData> lessonContentDataList) {
		this.lessonContentDataList = lessonContentDataList;
	}



	@Override
	public int getCount() {
		return lessonContentDataList.size();
	}

	@Override
	public LessonContentData getItem(final int position) {
		return lessonContentDataList.get(position);
	}

	@Override
	public long getItemId(final int position) {
		return position;
	}

}
